-
Notifications
You must be signed in to change notification settings - Fork 1.9k
lastgenre: Use albumartists field to improve last.fm results / fetch_genre helpers refactor #5981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
JOJ0
wants to merge
4
commits into
master
Choose a base branch
from
lastgenre_multi_artist_fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+36
−21
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
86e07aa to
2a27349
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5981 +/- ##
==========================================
- Coverage 66.50% 66.38% -0.13%
==========================================
Files 117 117
Lines 18123 18141 +18
Branches 3071 3081 +10
==========================================
- Hits 12052 12042 -10
- Misses 5415 5444 +29
+ Partials 656 655 -1
🚀 New features to boost your workflow:
|
c7fec68 to
58463f0
Compare
58463f0 to
314a914
Compare
314a914 to
283817d
Compare
JOJ0
pushed a commit
that referenced
this pull request
Nov 16, 2025
b315397 to
bea2594
Compare
Reduce fetcher methods to 3: last.fm can be asked for for a genre for these combinations of metadata: - albumartist/album - artist/track - artist Passing them in the callers instead of hiding it in the methods also helps readability in _get_genre().
In case the albumartist genre can't be found (often due to variations of artist-combination wording issues, eg "featuring", "+", "&" and so on) use the albumartists list field, fetch a genre for each artist separately and concatenate them.
bea2594 to
7668957
Compare
instead of obj.items()
7668957 to
c496627
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Often last.fm does not find artist genres for delimiter-separated artist names (eg. "Artist One, Artist Two") or where multiple artists are combined with "concatenation words" like "and" , "+", "featuring" and so on.
This fix gathers each artist's last.fm genre separately by using Beets' mutli-valued
albumartistsfield to improve the likeliness of finding genres in the artist genre fetching stage.Additionally refactoring was done along the existing genre fetching helper functions (
fetch_album_genre,fetch_track_genre, ...):last.fm can be asked for genre for these combinations of metadata:
Instead of passing
AlbumorItemobjects directly to these helpers., generalize them and pass the (string) metadata directly.Passing "what's to fetch" in the callers instead of hiding it in the methods also helps readability in
_get_genre()And reduces the requirement at hand for another additional method (or adaptation) to support "multi-albumartist genre fetching"
DocumentationChangelog
Tests